package com.brokendust.client;

import com.brokendust.client.api.PixelConnect;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraftforge.fml.common.Mod;

@Mod("pixelengine")
public class PixelEngine {

    private static Logger LOGGER;
    public static PixelEngine pixelengine;
    public static Minecraft minecraft;
    public static ItemRenderer itemRenderer;
    public static FontRenderer fontRenderer;

    public static PixelConnect pixelConnect;

    public PixelEngine(){
        PixelEngine.pixelengine = this;
        FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
        PixelEngine.pixelConnect = new PixelConnect();
    }

    private void setup(FMLCommonSetupEvent event) {
        PixelEngine.minecraft = Minecraft.getInstance();
        PixelEngine.itemRenderer = PixelEngine.minecraft.getItemRenderer();
        PixelEngine.fontRenderer = PixelEngine.minecraft.font;
    }

    public static void sendLogger(String message) {
        PixelEngine.LOGGER.info(message);
    }

    static {
        LOGGER = LogManager.getLogger();
    }

}
